	<!DOCTYPE html>
<html lang="zh-Hans">
	<head>
		<!--[if lt IE 9]>
        	<style>body {display: none; background: none !important} </style>
        	<meta http-equiv="Refresh" Content="0; url=//outdatedbrowser.com/" />
    	<![endif]-->

		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1" />
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
		<meta name="format-detection" content="telephone=no" />
		<meta name="author" content="Shawn" />
		

		<link rel="apple-touch-icon" href="http://og6esej9r.bkt.clouddn.com/me-0.JPG">
		<link rel="alternate" href="/atom.xml" title="诗酒趁年华" type="application/atom+xml">
		<link rel="shortcut icon" href="/img/me.JPG">
		<link href="//cdn.bootcss.com/animate.css/3.5.1/animate.min.css" rel="stylesheet">
		<link href="//cdn.bootcss.com/fancybox/2.1.5/jquery.fancybox.min.css" rel="stylesheet">
		<script src="//cdn.bootcss.com/pace/1.0.2/pace.min.js"></script>
    	<link href="//cdn.bootcss.com/pace/1.0.2/themes/blue/pace-theme-loading-bar.css" rel="stylesheet">
		<link rel="stylesheet" href="/css/style.css">
		
		

		<link href="//cdn.bootcss.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet">
		
		<title>重头再来:Mac上搭建基于GitHub的Hexo博客 | 诗酒趁年华</title>

		<script src="//cdn.bootcss.com/jquery/2.2.4/jquery.min.js"></script>
		<script src="//cdn.bootcss.com/clipboard.js/1.5.10/clipboard.min.js"></script>
		<!--<script src="/js/huaji.js"></script>-->
		
		<script src="/js/APlayer.min.js"></script>
		<script src="/js/canvas.js"></script>
  		<script src="/js/leftmusic.js"></script>
  		<script src="/js/jquery.marquee.min.js"></script>
  		<script src="//code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
		
		 
		<!-- Live2D Library -->
        <script src="/js/live2d.min.js"></script>        
        <!-- Live2D Framework -->
        <script src="/js/Live2DFramework.js"></script>
        <!-- User's Script -->
    	<script src="/js/utils/MatrixStack.js"></script>
        <script src="/js/utils/ModelSettingJson.js"></script>
        <script src="/js/PlatformManager.js"></script>
        <script src="/js/LAppDefine.js"></script>
        <script src="/js/LAppModel.js"></script>
        <script src="/js/LAppLive2DManager.js"></script>
        <script src="/js/22.js"></script>	
         		        
	
		<script>
  			var yiliaConfig = {
     	   		fancybox: true,
        		animate: true,
        		isHome: false,
        		isPost: true,
        		isArchive: false,
        		isTag: false,
        		isCategory: false,
        		fancybox_js: "//cdn.bootcss.com/fancybox/2.1.5/jquery.fancybox.min.js",
        		scrollreveal: "//cdn.bootcss.com/scrollReveal.js/3.1.4/scrollreveal.min.js",
        		search: true
    		}
		</script>
		
		
		
		<script>
        	yiliaConfig.jquery_ui = [true, "//cdn.bootcss.com/jqueryui/1.10.4/jquery-ui.min.js", "//cdn.bootcss.com/jqueryui/1.10.4/css/jquery-ui.min.css"];
    	</script>
		

		<script> yiliaConfig.rootUrl = "\/";</script>	
		

		
	</head>

	 
		<body onload="ThisIs22()">
	
  		<div id="container">
    		<div class="left-col">
    			<div class="overlay"></div>
    			<div class="intrude-less">
	    			<header id="header" class="inner">
            			<a href="/" class="profilepic">
                			<img src="/img/me.JPG" class="animated zoomIn">
            			</a>
            			<hgroup>
              				<h1 class="header-author" style="width:100%"><a href="/">Shawn</a></h1>
            			</hgroup>
            			<p class="header-subtitle">一个喜欢捣鼓前端的产品汪。<br/>总字数：<span class="post-count" style="font-weight: bold;font-family: Arial, Helvetica, "宋体";color: black;">17.8k</span></p>

            			<form id="search-form"> <!-- 搜索框相关 -->
    			    		<input type="text" id="local-search-input" name="q" results="0" placeholder="" class="search form-control" autocomplete="off" autocorrect="off"/>
   				    		<i class="fa fa-times" onclick="resetSearch()"></i> <!-- 清空/重置搜索框 -->
			    		</form>
			    		<div id="local-search-result"></div> <!-- 搜索结果区 -->
			    		<p class='no-result'>啊哦。。。<br/>没有符合条件的文章。。。<br/>∠( ᐛ 」∠)＿</p> <!-- 无匹配时显示，注意请在 CSS 中设置默认隐藏 -->
            			
            			<div id="switch-area" class="switch-area">
    			            <div class="switch-wrap">
    			                <section class="switch-part switch-part1">
    			                    <nav class="header-menu">
    			                    	<a href="/" title="回到首页"><i class="fa fa-home"></i></a>
    			                    	<a href="/archives/" title="文章归档"><i class="fa fa-archives"></i></a>
    			                    	<a href="/tags/" title="标签/分类"><i class="fa fa-tags"></i></a>
    			                    	<a href="/photoes/" title="照片/壁纸"><i class="fa fa-photo"></i></a>
    			                    	<a href="/friends/" title="友情链接"><i class="fa fa-links"></i></a>
    			                    	<a href="/about/" title="关于我/留言板"><i class="fa fa-about"></i></a>
    			                    	<a href="/download/" title="相关下载"><i class="fa fa-download"></i></a>
    									<a class="set-view-mode" href="javascript:void(0)" title="夜间模式"><i class="fa fa-moon-o"></i></a>
    			                    </nav>
    			                </section>   
    			                <section class="switch-part switch-part2">
    			                    <div class="widget tagcloud" id="js-tagcloud">
    			                        <ul class="tag-list"><li class="tag-list-item"><a class="tag-list-link" href="/tags/2017/">2017</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/CDN/">CDN</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/DFS/">DFS</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Github/">Github</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/HTML5/">HTML5</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Hexo/">Hexo</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/JavaScript/">JavaScript</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/PS/">PS</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/SSL/">SSL</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/flag/">flag</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/https/">https</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/localStorage/">localStorage</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/nginx/">nginx</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/sessionStorage/">sessionStorage</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/夜间模式/">夜间模式</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/影评/">影评</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/文档/">文档</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/服务学/">服务学</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/编译原理/">编译原理</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/随笔/">随笔</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/项目管理/">项目管理</a></li></ul>
    			                    </div>
    			                </section>
    			                
    			                            
 			            	</div>
 			            	<div class="marquee"><script type="text/javascript" src="https://api.lwl12.com/hitokoto/main/get?encode=js&charset=utf-8"></script><div id="lwlhitokoto"><script>lwlhitokoto()</script></div></div><script>$('.marquee').marquee();</script>
    			        </div>
    			    </header>   
    			</div>
    			       
    		</div>
    		 
    			<script src="//cdn.bootcss.com/jqueryui/1.10.4/jquery-ui.min.js"></script>
    			<script src="/js/move.js"></script>
    			<div id="movediv"> 
        			<canvas id="glcanvas" width="170" height="200"> <button id="btnChange" class="active" style="visibility:hidden;width=10px!important;">C</button></canvas>
    			</div>
    		
    		<div class="xm"><img src="/img/xm.png"></div>
    		<div class="mid-col">
    			<nav id="mobile-nav">
      <div class="overlay">
          <div class="slider-trigger"></div>
          <h1 class="header-author js-mobile-header hide"><a href="/" title="回到主页">Shawn</a></h1>
      </div>
    <div class="intrude-less">
        <header id="header" class="inner">
            <a href="/" class="profilepic">
                <img src="/img/me.JPG" class="animated zoomIn">
            </a>
            <hgroup>
              <h1 class="header-author"><a href="/" title="回到主页">Shawn</a></h1>
            </hgroup>
            
            <p class="header-subtitle"><span class="post-count">一个喜欢捣鼓前端的产品汪。<br/>总字数：17.8k</span></p>
            
            <nav class="header-menu">
            	<div>
    			<a href="/" title="回到首页"><i class="fa fa-home"></i></a>
    			<a href="/archives/" title="文章归档"><i class="fa fa-archives"></i></a>
    			<a href="/tags/" title="标签/分类"><i class="fa fa-tags"></i></a>
    			<a href="/photoes/" title="照片/壁纸"><i class="fa fa-photo"></i></a>
    			<a href="/friends/" title="友情链接"><i class="fa fa-links"></i></a>
    			</div>
    			<div>
    			<a href="/about/" title="关于我/留言板"><i class="fa fa-about"></i></a>
    			<a href="/download/" title="相关下载"><i class="fa fa-download"></i></a>
    			<a class="set-view-mode" href="javascript:void(0)" title="夜间模式"><i class="fa fa-moon-o"></i></a>
    			</div>
    		</nav><br/><br/><br/>
        </header>                
    </div>
    <link class="menu-list" tags="标签" friends="友情链接" about="关于我"/>
</nav>
      			<div class="body-wrap"><article id="post-RestartBlog" class="article article-type-post" itemscope itemprop="blogPost">
  
    <div class="article-meta">
      <a href="/2016/11/05/RestartBlog/" class="article-date">
      <time datetime="2016-11-05T10:10:18.000Z" itemprop="datePublished">2016-11-05</time>
</a>


    </div>
  
  <div class="article-inner">
    
      <input type="hidden" class="isFancy" />
    
    
      <header class="article-header">
        
  
    <h1 class="article-title" itemprop="name">
      		重头再来:Mac上搭建基于GitHub的Hexo博客
    </h1>
  

      </header>
      
      <div class="article-info article-info-post">
        
    <div class="article-category tagcloud">
    <a class="article-category-link" href="/categories/教程/">教程</a>
    </div>


        
    <div class="article-tag tagcloud">
        <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/Github/">Github</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/Hexo/">Hexo</a></li></ul>
    </div>

        <div class="clearfix"></div>
      </div>
      
    
    <div class="article-entry" itemprop="articleBody">
      
          
        <p><span class="suojin"></span>又是一个新的学期，上学期就用WordPress搭建了个博客，但是感觉太low，这学期重新用hexo搭建了一个新的博客，还算满意，希望以后能在这里进步。简单写下些经验来分享，希望能帮大家少踩些坑。</p>
<a id="more"></a>
<h2 id="环境配置"><a href="#环境配置" class="headerlink" title="环境配置"></a>环境配置</h2><p><span class="suojin"></span><a href="https://hexo.io/docs" target="_blank" rel="external">Hexo官网</a>上本来就有对Hexo安装及使用的详细介绍，这里来讲述下我自己安装的过程，可能会有一些区别。</p>
<h3 id="Node-js"><a href="#Node-js" class="headerlink" title="Node.js"></a>Node.js</h3><p><span class="suojin"></span>用来生成静态页面。移步<a href="https://nodejs.org/en/" target="_blank" rel="external">Node.js官网</a>，下载安装即可。</p>
<h3 id="Git"><a href="#Git" class="headerlink" title="Git"></a>Git</h3><p><span class="suojin"></span>用来将本地Hexo内容提交到Github上。Xcode自带Git，这里不再赘述。如果没有Xcode可以参考<a href="https://hexo.io/docs" target="_blank" rel="external">Hexo官网</a>上的安装方法。</p>
<h2 id="安装Hexo"><a href="#安装Hexo" class="headerlink" title="安装Hexo"></a>安装Hexo</h2><p><span class="suojin"></span>当Node.js和Git都安装好后就可以正式安装Hexo了，终端执行如下命令：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">sudo npm install -g hexo</div></pre></td></tr></table></figure>
<p><span class="suojin"></span>输入管理员密码（Mac登录密码）即开始安装 (sudo:linux系统管理指令  -g:全局安装)</p>
<blockquote>
<p>注意：Hexo官网上的安装命令是 npm\ install\ -g\ hexo-cli，<br>安装时不要忘记前面加上sudo，否则会因为权限问题报错。</p>
</blockquote>
<h2 id="初始化"><a href="#初始化" class="headerlink" title="初始化"></a>初始化</h2><p><span class="suojin"></span>终端cd到一个你选定的目录，执行<code>hexo init</code>命令</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">hexo init blog</div></pre></td></tr></table></figure>
<p><span class="suojin"></span>blog是你建立的文件夹名称。cd到<code>blog</code>文件夹下，执行如下命令，安装npm：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">npm instal</div></pre></td></tr></table></figure>
<p><span class="suojin"></span>执行如下命令，开启hexo服务器：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">hexo server(或者hexo s)</div></pre></td></tr></table></figure>
<p><span class="suojin"></span>此时，浏览器中打开网址<a href="http://localhost:4000" target="_blank" rel="external">http://localhost:4000</a>，能看到如下页面：</p>
<p style="text-align:center"><br><img src="http://pictures.shawnzeng.com/restart-1.png" alt="restart-1" width="100%/"><br></p>

<p><span class="suojin"></span>本地设置好后，接下来开始关联Github。</p>
<h2 id="关联Github"><a href="#关联Github" class="headerlink" title="关联Github"></a>关联Github</h2><h3 id="创建仓库"><a href="#创建仓库" class="headerlink" title="创建仓库"></a>创建仓库</h3><p><span class="suojin"></span>登录你的Github帐号，新建仓库，名为<code>用户名.github.io</code>固定写法，如<code>ZengShuai1996.github.io</code>即下图中2所示：</p>
<p style="text-align:center"><br><img src="http://pictures.shawnzeng.com/restart-2.png" alt="restart-2" width="100%/"><br></p>

<p><span class="suojin"></span>本地的<code>blog</code>文件夹下内容为：</p>
<blockquote>
<p>_config.yml<br>db.json<br>node_modules<br>package.json<br>scaffolds<br>source<br>themes   </p>
</blockquote>
<p><span class="suojin"></span>终端cd到<code>blog</code>文件夹下，<code>vim</code>打开<code>_config.yml</code>(或者直接在相应文件夹打开)，命令如下：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">vim _config.yml</div></pre></td></tr></table></figure>
<p><span class="suojin"></span>打开后往下滑到最后，修改成下边的样子：</p>
<blockquote>
<p>deploy:<br>&nbsp;&nbsp;&nbsp;&nbsp;type: git<br>&nbsp;&nbsp;&nbsp;&nbsp;repository: <a href="https://github.com/ZengShuai1996/ZengShuai1996.github.io.git" target="_blank" rel="external">https://github.com/ZengShuai1996/ZengShuai1996.github.io.git</a><br>&nbsp;&nbsp;&nbsp;&nbsp;branch: master  </p>
</blockquote>
<p><span class="suojin"></span>你需要将<code>repository</code>后<code>ZengShuai1996</code>换成你自己的用户名，地址在上图2位置获取。hexo\ 3.1.1版本后<code>type:</code>值为<code>git</code>。</p>
<blockquote>
<p>注意：在配置所有的\_config.yml文件时（包括theme中的），在所有的冒号:后边都要加一个空格，否则执行hexo命令会报错，切记！</p>
</blockquote>
<p><span class="suojin"></span>在<code>blog</code>文件夹目录下执行生成静态页面命令：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">hexo generate(或者hexo g)</div></pre></td></tr></table></figure>
<p>&nbsp;  </p>
<blockquote>
<p>此时若出现如下报错：<br>ERROR Local hexo not found in ~/blog<br>ERROR Try runing: ‘npm install hexo –save’<br>则执行命令：<br>npm install hexo –save<br>若无报错，自行忽略此步骤。  </p>
</blockquote>
<p><span class="suojin"></span>再执行配置命令：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">hexo deploy		或者：hexo d</div></pre></td></tr></table></figure>
<p>&nbsp;  </p>
<blockquote>
<p>注意：若执行命令hexo\ deploy仍然报错：无法连接git或找不到  git，则执行如下命令来安装hexo-deployer-git：</p>
</blockquote>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">npm install hexo-deployer-git --save</div></pre></td></tr></table></figure>
<p><span class="suojin"></span>再次执行<code>hexo generate</code>和<code>hexo deploy</code>命令。</p>
<p><span class="suojin"></span>若你未关联Github，则执行<code>hexo deploy</code>命令时终端会提示你输入Github的用户名和密码，即</p>
<blockquote>
<p>Username for ‘<a href="https://github.com" target="_blank" rel="external">https://github.com</a>‘:<br>Password for ‘<a href="https://github.com" target="_blank" rel="external">https://github.com</a>‘:  </p>
</blockquote>
<p><span class="suojin"></span><code>hexo deploy</code>命令执行成功后，浏览器中打开网址<a href="http://ZengShuai1996.github.io" target="_blank" rel="external">http://ZengShuai1996.github.io</a>（将<code>ZengShuai1996</code>换成你的用户名）能看到和打开<code>http://localhost:4000</code>时一样的页面。</p>
<p><span class="suojin"></span><strong>为避免每次输入Github用户名和密码的麻烦，可参照第二节方法</strong></p>
<h3 id="添加ssh-key到Github"><a href="#添加ssh-key到Github" class="headerlink" title="添加ssh\ key到Github"></a>添加ssh\ key到Github</h3><p><strong>检查SSH\ keys是否存在Github</strong></p>
<p><span class="suojin"></span>执行如下命令，检查SSH\ keys是否存在。如果有文件<code>id_rsa.pub</code>或<code>id_dsa.pub</code>，则直接进入步骤2.3将SSH\ key添加到Github中，否则进入下一步生成SSH\ key。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">ls -al ~/.ssh</div></pre></td></tr></table></figure>
<p><strong>生成新的ssh\ key</strong></p>
<p><span class="suojin"></span>执行如下命令生成public/private\ rsa\ key\ pair，注意将<code>your_email@example.com</code>换成你自己注册Github的邮箱地址。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">ssh-keygen -t rsa -C &quot;your_email@example.com&quot;</div></pre></td></tr></table></figure>
<p><span class="suojin"></span>默认会在相应路径下（<code>~/.ssh/id_rsa.pub</code>）生成<code>id_rsa</code>和<code>id_rsa.pub</code>两个文件。</p>
<p><strong>将ssh\ key添加到Github中</strong></p>
<p><span class="suojin"></span>Finder前往文件夹<code>~/.ssh/id_rsa.pub</code>打开<code>id_rsa.pub</code>文件，里面的信息即为SSH\ key，将这些信息复制到Github的Add\ SSH\ key页面即可。</p>
<p><span class="suojin"></span>进入Github\rightarrow Settings\rightarrow SSH\ keys\rightarrow add\ SSH\ key:</p>
<p><span class="suojin"></span>Title里任意添一个标题，将复制的内容粘贴到Key里，点击下方<code>Add key</code>绿色按钮即可。</p>
<h3 id="发布文章"><a href="#发布文章" class="headerlink" title="发布文章"></a>发布文章</h3><p><span class="suojin"></span>终端cd到<code>blog</code>文件夹下，执行如下命令新建文章：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">hexo new &quot;postName&quot;</div></pre></td></tr></table></figure>
<p><span class="suojin"></span>名为<code>postName.md</code>的文件会建在目录<code>/blog/source/_posts</code>下。你当然可以用vim来编辑文章。<s>我在用Mou编辑器，支持预览，虽然其预览不支持latex，如果你有好用的markdown编辑器请推荐给我，感激不尽！</s>  </p>
<p style="text-align:center">—–2016/12/3更新：现使用MacDown编辑器，支持latex预览，推荐大家使用！—–</p>

<p><span class="suojin"></span>文章编辑完成后，终端cd到<code>blog</code>文件夹下，执行如下命令来发布：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">hexo generate//生成静态页面 </div><div class="line">hexo deploy//将文章部署到Github</div></pre></td></tr></table></figure>
<p><span class="suojin"></span><strong>至此，Mac上搭建基于Github的Hexo博客就完成了。Congratulations!</strong></p>
<hr>

      
    </div>
    
  </div>
  
	<! -- 添加打赏功能 -->
<div class ="post-donate">
    <div id="donate_board" class="donate_bar center">
        <a id="btn_donate" class="btn_donate" href="javascript:;" title="打赏">￥打赏</a><span class="donate_txt">赞助吃土少年！￣﹃￣</span>
    </div>  
	<div id="donate_guide" class="donate_bar center hidden" >
		<!-- 支付宝打赏图案 --><img src="/img/zhifubaodonate.png" alt="支付宝打赏" /> 
		<!-- 微信打赏图案 --><img src="/img/weixindonate.png" alt="微信打赏" />  
    </div>
	<script type="text/javascript">
		document.getElementById('btn_donate').onclick = function(){
			$('#donate_board').addClass('hidden');
			$('#donate_guide').removeClass('hidden');
		}
	</script>
</div>
  
  
    
    <div class="copyright">
        <p><span>本文标题:</span><a href="/2016/11/05/RestartBlog/">重头再来:Mac上搭建基于GitHub的Hexo博客</a></p>
        <p><span>文章作者:</span><a href="/" title="回到主页">Shawn</a></p>
        <p><span>本文字数:</span><span class="post-count">1,239字</span></p>
        <p><span>发布时间:</span>2016-11-05, 18:10:18</p>
        <p><span>最后更新:</span>2017-01-27, 22:23:59</p>
        <p>
            <span>原始链接:</span><a class="post-url" href="/2016/11/05/RestartBlog/" title="重头再来:Mac上搭建基于GitHub的Hexo博客">http://shawnzeng.com/2016/11/05/RestartBlog/</a>
            <span class="copy-path" data-clipboard-text="原文: http://shawnzeng.com/2016/11/05/RestartBlog/　　作者: Shawn" title="点击复制文章链接"><i class="fa fa-clipboard"></i></span>
            <script> var clipboard = new Clipboard('.copy-path'); </script>
        </p>
        <p>
            <span>许可协议:</span><i class="fa fa-creative-commons"></i> <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/" title="CC BY-NC-SA 4.0 International" target = "_blank">"署名-非商用-相同方式共享 4.0"</a> 转载请保留原文链接及作者。
        </p>
    </div>



    <nav id="article-nav">
        
            <div id="article-nav-newer" class="article-nav-title">
                <a href="/2016/11/28/SDAPM-Project-Charter/">
                    Software Development And Project Management Homework——Project Charter
                </a>
            </div>
        
        
    </nav>

  
  
</article>

    <div id="toc" class="toc-article">
        <strong class="toc-title">文章目录</strong>
        
            <ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#环境配置"><span class="toc-number">1.</span> <span class="toc-text">环境配置</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#Node-js"><span class="toc-number">1.1.</span> <span class="toc-text">Node.js</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#Git"><span class="toc-number">1.2.</span> <span class="toc-text">Git</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#安装Hexo"><span class="toc-number">2.</span> <span class="toc-text">安装Hexo</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#初始化"><span class="toc-number">3.</span> <span class="toc-text">初始化</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#关联Github"><span class="toc-number">4.</span> <span class="toc-text">关联Github</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#创建仓库"><span class="toc-number">4.1.</span> <span class="toc-text">创建仓库</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#添加ssh-key到Github"><span class="toc-number">4.2.</span> <span class="toc-text">添加ssh\ key到Github</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#发布文章"><span class="toc-number">4.3.</span> <span class="toc-text">发布文章</span></a></li></ol></li></ol>
        
    </div>
    <style>
        .left-col .switch-btn,
        .left-col .switch-area {
            display: none;
        }
        .toc-level-3 i,
        .toc-level-3 ol {
            display: none !important;
        }
    </style>

    <input type="button" id="tocButton" value="隐藏目录"  title="点击按钮隐藏或者显示文章目录">

    <script>
        yiliaConfig.toc = ["隐藏目录", "显示目录", !!"false"];
    </script>



    <div class="share">
    
        <div class="bdsharebuttonbox">
            <a href="#" class="fa fa-twitter bds_twi" data-cmd="twi" title="分享到推特"><span class=""></a>
            <a href="#" class="fa fa-weibo bds_tsina" data-cmd="tsina" title="分享到新浪微博"></a>
            <a href="#" class="fa fa-qq bds_sqq" data-cmd="sqq" title="分享给 QQ 好友"></a>
            <a href="#" class="fa fa-files-o bds_copy" data-cmd="copy" title="复制网址"></a>
            <a href="#" class="fa fa fa-envelope-o bds_mail" data-cmd="mail" title="通过邮件分享"></a>
            <a href="#" class="fa fa-weixin bds_weixin" data-cmd="weixin" title="生成文章二维码"></a>
            <a href="#" class="fa fa-share-alt bds_more" data-cmd="more"></i></a>
        </div>
       <script>
            window._bd_share_config={
                "common":{"bdSnsKey":{},"bdText":"重头再来:Mac上搭建基于GitHub的Hexo博客　| 诗酒趁年华　","bdMini":"2","bdMiniList":false,"bdPic":"","bdStyle":"0","bdSize":"24"},"share":{}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='//bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];
        </script>
    

    
</div>







    
      <div class="duoshuo" id="comments">
    <div id="comment-box" ></div>
    <div class="ds-thread" id="ds-thread" data-thread-key="2016/11/05/RestartBlog/" data-title="重头再来:Mac上搭建基于GitHub的Hexo博客" data-url="http://shawnzeng.com/2016/11/05/RestartBlog/"></div>
    <script type="text/javascript">
        var duoshuoQuery = {short_name:"zengshuai1996"};
        var loadComment = function(){
            var d = document, s = d.createElement('script');
            //s.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//shawnzeng.com/js/embed.js';
            s.src = '/js/embed.js';
            s.async = true; s.charset = 'UTF-8';
            (d.head || d.body).appendChild(s);
        }

        
    </script>
    
    <script> loadComment(); </script>

</div>
    




    <div class="scroll" id="post-nav-button">
        
            <a href="/2016/11/28/SDAPM-Project-Charter/" title="上一篇: Software Development And Project Management Homework——Project Charter">
                <i class="fa fa-angle-left"></i>
            </a>
        

        <a title="文章列表"><i class="fa fa-bars"></i><i class="fa fa-times"></i></a>

        
            <a href="/" title="回到主页"><i class="fa fa-home"></i></a>
        
    </div>

    <ul class="post-list"><li class="post-list-item"><a class="post-list-link" href="/2017/04/14/StopHexo/">停止更新</a></li><li class="post-list-item"><a class="post-list-link" href="/2017/01/30/Https/">腾讯云Centos7启用https</a></li><li class="post-list-item"><a class="post-list-link" href="/2017/01/25/AddBaiduCDN/">给自己的博客添加CDN加速</a></li><li class="post-list-item"><a class="post-list-link" href="/2017/01/18/NightMode/">给自己的主题添加夜间模式</a></li><li class="post-list-item"><a class="post-list-link" href="/2017/01/13/2017hanjiaplan/">2017寒假计划get√！</a></li><li class="post-list-item"><a class="post-list-link" href="/2017/01/13/PSPic/">使用PS压缩背景图</a></li><li class="post-list-item"><a class="post-list-link" href="/2017/01/10/Algorithm-homework/">算法设计与分析——突破O(m)时间复杂度限制的无向图动态深度优先算法</a></li><li class="post-list-item"><a class="post-list-link" href="/2016/12/31/Hi2017/">2017新年快乐！</a></li><li class="post-list-item"><a class="post-list-link" href="/2016/12/30/HuaJi/">滑稽大盗</a></li><li class="post-list-item"><a class="post-list-link" href="/2016/12/27/Serviceology02/">服务学作业——堆糖电商服务建模</a></li><li class="post-list-item"><a class="post-list-link" href="/2016/12/14/Compile_SubsetConstruction_Algorithm/">编译原理——子集构造法</a></li><li class="post-list-item"><a class="post-list-link" href="/2016/12/05/HexoStudy/">Hexo学习笔记</a></li><li class="post-list-item"><a class="post-list-link" href="/2016/12/05/AddUML/">给hexo添加uml时序图和流程图功能</a></li><li class="post-list-item"><a class="post-list-link" href="/2016/12/03/YourName/">「君の名は。」</a></li><li class="post-list-item"><a class="post-list-link" href="/2016/12/01/Yoga/">林宥嘉：她说好</a></li><li class="post-list-item"><a class="post-list-link" href="/2016/11/30/Compile02/">编译原理——语言及其文法</a></li><li class="post-list-item"><a class="post-list-link" href="/2016/11/30/Compile01/">编译原理——简介</a></li><li class="post-list-item"><a class="post-list-link" href="/2016/11/28/SDAPM-Scope-Statement/">Software Development And Project Management Homework——Scope Statement</a></li><li class="post-list-item"><a class="post-list-link" href="/2016/11/28/SDAPM-Project-Charter/">Software Development And Project Management Homework——Project Charter</a></li><li class="post-list-item"><a class="post-list-link" href="/2016/11/05/RestartBlog/">重头再来:Mac上搭建基于GitHub的Hexo博客</a></li></ul>




    <script>
        
    </script>
</div>
      			<footer id="footer">
    <div class="outer">
        <div id="footer-info">
            <div class="footer-left">
                <i class="fa fa-copyright"></i> 
                2016-2017 <i class="fa fa-heart animated infinite pulse"></i> Shawn <a href="http://www.miitbeian.gov.cn">黑ICP备17000197号-1</a>
            </div>
            <div class="footer-right">
            	<span class="my-face">(●'◡'●)ﾉ</span>
				<span id="span_dt_dt"></span>
            </div>
        </div>
        
            <div class="visit">
                
                    <span id="busuanzi_container_site_pv" style='display:none'>
                        <span id="site-visit" title="本站到访数"><i class="fa fa-user" aria-hidden="true"></i><span id="busuanzi_value_site_uv"></span>
                        </span>
                    </span>
                
                
                    <span>| </span>
                
                
                    <span id="busuanzi_container_page_pv" style='display:none'>
                        <span id="page-visit"  title="本页阅读量"><i class="fa fa-eye animated infinite pulse" aria-hidden="true"></i><span id="busuanzi_value_page_pv"></span>
                        </span>
                    </span>
                
            </div>
        
    </div>
</footer>

    		</div>
    		<script>
(function(){
    var bp = document.createElement('script');
    var curProtocol = window.location.protocol.split(':')[0];
    if (curProtocol === 'https') {
        bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';        
    }
    else {
        bp.src = 'http://push.zhanzhang.baidu.com/push.js';
    }
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(bp, s);
})();
</script>


    <script src="/js/raphael.js"></script>
    <script src="/js/underscore.js"></script>
    <script src="/js/sequence-diagram.js"></script>
    <script src="/js/flowchart.js"></script>
    
<!-- Chart Render -->
<script type="text/javascript">
  $(".sequence").sequenceDiagram({theme: 'simple'});
  var flowCount = 0;
  $(".flow").each(function() {
      var el = $(this);
      el.hide();
      el.after('<div id="flow-' + flowCount + '"></div>');
      var chart = flowchart.parse(el.text());
      chart.drawSVG('flow-' + flowCount);
      flowCount++;
  });
</script>
<!-- End Chart Render -->


<script data-main="/js/main.js" src="//cdn.bootcss.com/require.js/2.2.0/require.min.js"></script>

    <script>
        $(document).ready(function() {
            var iPad = window.navigator.userAgent.indexOf('iPad');
            if (iPad > -1 || $(".left-col").css("display") === "none") {
                var bgColorList = ["#9db3f4", "#414141", "#e5a859", "#f5dfc6", "#c084a0", "#847e72", "#cd8390", "#996731"];
                var bgColor = Math.ceil(Math.random() * (bgColorList.length - 1));
                $("body").css({"background-color": bgColorList[bgColor], "background-size": "cover"});
            }
            else {
                var backgroundnum = 5;
                var backgroundimg = "url(/background/bg-x.jpg)".replace(/x/gi, Math.ceil(Math.random() * backgroundnum));
                $("body").css({"background": backgroundimg, "background-attachment": "fixed", "background-size": "cover"});
            }
        })
    </script>





    <script type="text/x-mathjax-config">
MathJax.Hub.Config({
  tex2jax: {
    inlineMath: [['$','$']],
    processEscapes: true,
    skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code'],
	linebreaks: { automatic: true, width: "container" }
  }
});

MathJax.Hub.Queue(function() {
    var all = MathJax.Hub.getAllJax(), i;
    for(i=0; i < all.length; i += 1) {
        all[i].SourceElement().parentNode.className += ' has-jax';                 
    }       
});
</script>

<!--script type="text/javascript" src="http://mathjax.josephjctang.com/MathJax.js?config=TeX-MML-AM_HTMLorMML"-->
<!--script type="text/javascript" src="//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"-->
<script type="text/javascript" src="//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_HTMLorMML">
</script>


<div class="scroll" id="scroll">
    <a href="#" title="返回顶部"><i class="fa fa-arrow-up"></i></a>
    <a href="#comments" onclick="load$hide();" title="查看评论"><i class="fa fa-comments-o"></i></a>
    <a href="#footer" title="转到底部"><i class="fa fa-arrow-down"></i></a>
</div>
<script>
    // Open in New Window
    
        var oOpenInNew = {
            
            
            
            
            
            
            
             miniArchives: "a.post-list-link", 
            
             friends: "#js-friends a", 
             socail: ".social a" 
        }
        for (var x in oOpenInNew) {
            $(oOpenInNew[x]).attr("target", "_blank");
        }
    
</script>

    <script>
        var originTitle = document.title;
        var titleTime;
        document.addEventListener("visibilitychange", function() {
            if (document.hidden) {
                document.title = "(つェ⊂)" + originTitle;
                clearTimeout(titleTime);
            }
            else {
                document.title = "(*´∇｀*)" + originTitle;
                titleTime = setTimeout(function() {
                    document.title = originTitle;
                }, 2000);
            }
        })
    </script>

<script async src="https://dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>
    		<div class="musicbox">
				<div class="player">
					<div id="player_bck" class="aplayer"></div>
				</div>
				<div class="pop-music" title="音乐"></div>
			</div>
  		</div>
  		<script src="/js/music.js"></script>
	</body>	
</html>